package top.anka1.fxgui;

import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.stage.Stage;
import javafx.stage.WindowEvent;

import java.io.IOException;
/**
 * JavaFX application for a zoo management system.
 * This class serves as the entry point for the application.
 * It initializes the main stage and loads the FXML layout.
 * @author Anka
 */
public class ZooApplication extends Application {
    @Override
    public void start(Stage stage) throws IOException {
        FXMLLoader fxmlLoader = new FXMLLoader(ZooApplication.class.getResource("zoo-view.fxml"));
        Scene scene = new Scene(fxmlLoader.load());
        ZooController zooController = fxmlLoader.getController();
        zooController.setStage(stage);
        stage.setOnCloseRequest((WindowEvent event) -> {
            event.consume();
            zooController.exitZoo();
        });
        stage.setTitle("Zoo management system");
        stage.setScene(scene);
        stage.show();
    }

    public static void main(String[] args) {
        launch();
    }
}
